<%@page import="java.util.UUID"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/pages/common/taglib.jsp" %>
<%
    String uuid = UUID.randomUUID().toString();
    request.setAttribute("uuid", uuid);
%>
<form id="searchDialog_${uuid}" style="display: none;" class="box-body"></form>
<div class="row">
	<div id="searchBox_${uuid}">
		<div class="box">
            <div class="box-body">
            	<form id="search_${uuid}" ></form>
            </div>
         </div>
	</div>
	<div id="gridBox_${uuid}">
		<div class="box box-primary">
			<div class="box-header with-border">
				<h3 class="box-title">
               		
               </h3>
               	<div class="box-tools pull-right" id="toolBar_${uuid}">
               		
               	</div>
            </div>
            <div class="box-body">
            	<table id="grid_${uuid}" style="width: 100%"></table>
            </div>
         </div>
	</div>
	<div id="script_${uuid}" style="display: none;">

	</div>
</div>

<script type="text/javascript">
$(function(){
	var code='${param.code}';
	var uuid = '${uuid}';
	/**
	搜索条件栏样式
	*/
	var searchDiv="#search_"+uuid
	var searchBarType='${param.sbType}'||'dialog';
	if(searchBarType=='left'){
		$("#searchBox_"+uuid).addClass("col-md-3");
		$("#gridBox_"+uuid).addClass("col-md-9");
	}else if(searchBarType=='top'){
		$("#search_"+uuid).addClass("form-float");
	}else if(searchBarType=='dialog'){
		searchDiv="#searchDialog_"+uuid;
		$(searchDiv).addClass("form-float");
		$("#searchBox_"+uuid).hide();
		$("#gridBox_"+uuid).addClass("col-md-12");
	}
	/**
	模式：
	serverEdit:服务端，可编辑模式
	clientEdit:客户端，可编辑模式
	select:选择模式
	view:查看模式
	serverEdit:混合，可编辑，可选择  
	*/
	var model='${param.model}'||'serverEdit';
	/**
	multi：多选
	single: 
	*/
	var selectModel='${param.selectModel}'||'multi';
	
	
	var winId='${param.winId}';
	
	requirejs(['wiseMen/dataModel/QueryDefTpl'],function(QueryDefTpl){
		if(model=='clientEdit'){
			$("#searchBox_"+uuid).hide();
			$("#gridBox_"+uuid).removeClass().addClass(".col-md-9");
		}
		var queryDefTpl=new QueryDefTpl({
			code:code,
			model:model,
			selectModel:selectModel,
			winId:winId,
			searchBarType:searchBarType,
			scriptDiv:"#script_"+uuid,//引用脚本的div
			searchDiv:searchDiv,//查询定义栏
			toolBarDiv:"#toolBar_"+uuid,//工具栏定义栏
			gridDiv:"#grid_"+uuid//grid表格
		});
	});
});
</script>